import json
from pages.gp_zjlx import GpZjPage
from pages.gp_bk import GpBk
from pages.gp_ztgy import GpZtGy
from pages.gp_homepage import GpHomePage as Gh
from config.gp_config import PathConfig, GpApiConfig
from tools.utils import log_time

class BaseApi:
    gp = GpZjPage


    @log_time
    def is_up(self, data) -> bool:
        """
            计算当日不是近五日的最低价，表示开始反弹
        """
        return self.gp.gp_min_or_max(data[:10], "spj", "min")[1] > 6

    def is_today_down(self, data) -> bool:
        """
            计算前近两日是下跌调整趋势
        """
        return self.gp.is_zd_down(data[:5])

    def is_zj_ok(self, data) -> bool:
        """
            计算10日资金净流入
        """
        return self.gp.gp_zj_is_ok(data[:5], "spj")

    def is_month_ok(self, data) -> bool:
        """
            计算30日内有涨停的数据
        """
        return self.gp.is_zt(data[:5]) < 1 and self.gp.is_zt(data[6:]) >= 1

    def is_bk_zt(self) -> bool:
        """
            计算板块中存在涨停
        """
        return True


